package com.cykj.user.mapper;

import com.cykj.user.domain.History;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Mapper;

import java.util.List;

@Mapper
public interface HistoryMapper {
    // 根据ID查询浏览记录
    History selectById(Long browseId);

    // 根据商家和用户查询浏览记录(基础字段)
    History selectByBusinessAndCustomer(
            @Param("businessId") Long businessId,
            @Param("customerId") Long customerId
    );

    // 根据商家和用户查询浏览记录(带店铺信息)
    History selectByBusinessAndCustomerWithShop(
            @Param("businessId") Long businessId,
            @Param("customerId") Long customerId
    );

    // 根据用户ID查询浏览历史
    List<History> selectByCustomerId(Long customerId);

    // 新增浏览记录
    int insertHistory(History history);

    // 更新浏览记录
    int updateHistory(History history);

    // 删除浏览记录
    int deleteHistory(Long browseId);
}
